const mysql = require('mysql2/promise');

async function main() {
    const db = {
        host: process.env.DB_HOST || '43.143.253.188',
        port: parseInt(process.env.DB_PORT || '3306', 10),
        user: process.env.DB_USER || 'nextjs',
        password: process.env.DB_PASS || 'yEAiRE2jcxTyRBy5',
        database: process.env.DB_NAME || 'nextjs',
        timezone: 'Z',
    };
    let conn;
    try {
        conn = await mysql.createConnection(db);
        const [rows] = await conn.execute('SELECT id,name,img,apIni,hpIni,mpIni,spIni,ap,hp,mp,sp,price FROM mount_base ORDER BY id ASC');
        console.log('mount_base: count=', rows.length);
        for (const r of rows) {
            console.log(`${r.id}\t${r.name}\tini(ap=${r.apIni},hp=${r.hpIni},mp=${r.mpIni},sp=${r.spIni})\tmax(ap=${r.ap},hp=${r.hp},mp=${r.mp},sp=${r.sp})\tprice=${r.price}`);
        }
    } catch (e) {
        console.error('inspect failed:', e.message);
        process.exit(1);
    } finally {
        if (conn) await conn.end();
    }
}

main();
